<include file='Common:header'/>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            系统配置组
            <small></small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{:U('Index/index')}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">配置组</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <form role="form" method="post">
            <!-- START CUSTOM TABS -->
            <div class="row">
                <div class="col-xs-12">
                    <!-- Custom Tabs -->
                    <div class="nav-tabs-custom">

                        <ul class="nav nav-tabs">

                            <li class="active"><a href="#tab_detail" data-toggle="tab">系统配置组</a></li>
                            <li><a href="javascript:void(0)" onclick="addGroup()">添加配置组</a></li>

                            <li class="pull-right"><a href="javascript:void(0)" onclick="addGroup()" class="text-muted"><i class="fa fa-gear"></i></a></li>
                        </ul>

                        <div class="tab-content">

                            <div class="tab-pane active" id="tab_detail">
                                <div style="width:100%;">
                                    <div class="box">
                                        <div class="box-header with-border">
                                            <h3 class="box-title">配置组列表</h3>
                                        </div><!-- /.box-header -->
                                        <div class="box-body">

                                            <table class="table table-condensed table-striped table-bordered table-hover dataTable no-footer">
                                                <tbody><tr>
                                                    <th style="width: 10px">ID</th>
                                                    <th style="width: 200px;">组名</th>
                                                    <th>中文标题</th>
                                                    <th class="text-center" style="width: 80px;">系统组</th>
                                                    <th class="text-center" style="width: 150px;">操作</th>
                                                </tr>
                                                <volist name="data" id="d">
                                                    <tr>
                                                        <td>{$d.cgid}</td>
                                                        <td>{$d.cgname}</td>
                                                        <td>{$d.cgtitle}</td>
                                                        <td class="res-status text-center" data-url="" data-id="{$d.cgid}" data-status-ok="是" data-status-no="否">
                                                            <if condition="$d[system] eq 1">
                                                                        <span data-toggle="tooltip" title="是">
                                                                            <i class="icon fa fa-check text-green"></i>
                                                                        </span>
                                                                <else/>
                                                                        <span data-toggle="tooltip" title="否">
                                                                            <i class="icon fa fa-close text-red"></i>
                                                                        </span>
                                                            </if>
                                                        </td>
                                                        <td class="text-center">
                                                            <if condition="$d['system']">
                                                                <i class="glyphicon glyphicon-edit text-gray"></i> &nbsp;
                                                                <i class="glyphicon glyphicon-trash text-gray"></i>
                                                                <else/>
                                                                <a href="javascript:void(0)" onclick="editGroup({$d.cgid})" title="修改"><i class="glyphicon glyphicon-edit"></i></a> &nbsp;
                                                                <a href="javascript:del({$d.cgid})" title="删除"><i class="glyphicon glyphicon-trash"></i></a>
                                                            </if>
                                                        </td>
                                                    </tr>
                                                </volist>
                                                </tbody></table>

                                        </div><!-- /.box-body -->
                                    </div><!-- /.box -->
                                </div>
                            </div><!-- /.tab-pane -->

                        </div><!-- /.tab-content -->

                    </div><!-- nav-tabs-custom -->
                </div><!-- /.col -->

            </div> <!-- /.row -->
            <!-- END CUSTOM TABS -->
        </form>

    </section><!-- /.content -->
</div><!-- /.content-wrapper -->


<!-- 模态框（Modal） -->
<div class="modal fade" id="addGroupModal" tabindex="-1" role="dialog"
     aria-labelledby="addModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="addModalLabel">
                    添加配置组
                </h4>
            </div>
            <form role="form" method="post" action="{:U('add')}">
                <div class="modal-body">

                    <div class="col-xs-12">
                        <!-- general form elements -->
                        <div class="box box-primary">

                            <div class="box-body">
                                <div class="form-group">
                                    <label for="cgname">组名称</label>
                                    <input type="text" placeholder="" id="cgname" name="cgname" class="form-control">
                                </div>
                                <div class="form-group">
                                    <label for="cgtitle">组标题</label>
                                    <input type="text" placeholder="" id="cgtitle" name="cgtitle" class="form-control">
                                </div>
                                <div class="form-group">
                                    <label for="cgorder">排序</label>
                                    <input type="text" placeholder="" id="cgorder" name="cgorder" value="0" class="form-control took-w100">
                                </div>
                            </div><!-- /.box-body -->

                        </div><!-- /.box -->

                    </div>
                    <!-- /.col-md -->

                </div>
                <div class="modal-footer" style="display:block; clear:both">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <button type="submit" class="btn btn-primary">
                        确定
                    </button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<script>
    //添加配置表单
    function addGroup() {
        //$('#addGroupModal').modal();
        var title = '添加配置组';
        var url = "{:U('add')}";
        ajaxForm(url, title);
    }

    function editGroup(id) {
        var title = '编辑配置组';
        var url = "{:U('edit',array('cgid'=>''))}" + id;
        ajaxForm(url, title);
    }

    //删除配置
    function del(id) {
        delItem('{:U('del')}', {cgid: id});
    }
</script>

<include file='Common:footer'/>